[bits 32]
global switch_ring3

switch_ring3:
	cli

	mov ax, 0x23
	mov ds, ax
	mov es, ax
	mov fs, ax
	mov gs, ax

	mov eax, [esp+4] ; get the stack
	
	push 0x23    	; ss
	push eax     	; esp
	pushf	     	; flags flags lol

	; toggle IF so user mode gets interrupts
	pop eax
	or eax, 0x200
	push eax

	push 0x1b     	; cs

	mov eax, [esp+8] ; get the eip

	push eax 	; eip
        iret		; make it happen, cap'n
	
